package org.okcjug.december.queue;

import static org.junit.Assert.*;

import java.util.PriorityQueue;

import org.junit.Test;

public class PriorityQ {
	@Test
	public void naturalSort(){
		PriorityQueue<Integer> q = new PriorityQueue<Integer>();
		q.add(new Integer(1));
		q.add(new Integer(5));
		q.add(new Integer(3));
		q.add(new Integer(2));
		q.add(new Integer(4));
		
		Integer oldValue = 0;
		while(q.peek() != null){
			
			Integer value = q.poll();
			assertTrue(oldValue.compareTo(value) < 0);
			assertFalse(value == null);
			
			System.out.println("Old value: " + oldValue
					+ " current value: " + value);
			
			oldValue = value;
		}
	}
}
